<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>
        床位管理
    </title>
    <style>
        th {
            text-align: center;
        }

        .topTitle {
            font-size: 16px;
            line-height: 30px;
            text-align: center;
        }
        .sps{
            height:22px;
            line-height:22px;
            padding:0 5px;
            font-size:13px;
            background-color:#EE4024;
            display:inline-block;
            color:#fff;
            white-space:nowrap;
            text-align:center;
            border:none;
            border-radius:0px;
            cursor:pointer;
            opacity:.9;
        }
        .spp{
            height:22px;
            line-height:22px;
            padding:0 5px;
            font-size:13px;
            background-color:#009688;
            display:inline-block;
            color:#fff;
            white-space:nowrap;
            text-align:center;
            border:none;
            border-radius:0px;
            cursor:pointer;
            opacity:.9;
        }
    </style>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../css/x-admin.css" media="all">
    <link rel="stylesheet" href="../css/pag.css" media="all">
    <link rel="stylesheet" href="../lib/layui/css/layui.css" media="all">
    <link type="text/css" rel="stylesheet" href="../js/jedate/test/jeDate-test.css">
    <link type="text/css" rel="stylesheet" href="../js/jedate/skin/jedate.css">
    <script type="text/javascript" src="../js/jedate/src/jedate.js"></script>
</head>
<body>
<div class="x-nav">
            <span class="layui-breadcrumb">
              <a><cite>住院管理</cite></a>
              <a><cite>床位管理</cite></a>
            </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon"
                                                                        style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <form class="layui-form x-center" action="" style="width:85%">
        <input type="hidden" name="currentPageNo" id="currentPageNo" value="${currentPageNo}">
        <div class="layui-form-pane">
            <div class="layui-form-item">
                <label class="layui-form-label">床位号</label>
                <div class="layui-input-inline" style="width:100px">
                    <input type="text" name="qrybNo" value="<c:if test='${qrybNo != 0}'>${qrybNo}</c:if>"
                           autocomplete="off" class="layui-input">
                </div>
                <label class="layui-form-label">床位状态</label>
                <div class="layui-input-inline" style="width:100px">
                    <select name="qryStatent" id="qryStatent">
                        <option value="0" selected="selected">请选择</option>
                        <option value="1" <c:if test="${qryStatent eq 1}">selected="selected"</c:if>>使用中</option>
                        <option value="2" <c:if test="${qryStatent eq 2}"> selected="selected"</c:if>>空闲中</option>
                    </select>
                </div>
                <label class="layui-form-label">科室</label>
                <div class="layui-input-inline" style="width:100px">
                    <input type="text" name="qryKName" value="${qryKName}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-input-inline" style="width:80px;height: 80px">
                    <button class="layui-btn" lay-submit="" lay-filter="*">搜索</button>
                </div>
            </div>
        </div>
    </form>

    <div class="topTitle">
        <strong>麒麟医院床位列表</strong>
    </div>
    <ul class="toolbar" style="margin-bottom: 10px">
        <li onclick="bedAdd();"><span><img src="../images/t01.png"/></span>添加</li>
    </ul>
    <span class="x-right"
          align="left">共${totalCount}条记录&nbsp;&nbsp;&nbsp;&nbsp;第${currentPageNo}页/共${totalPageCount}页
    </span>
    <table class="tablelist">
        <thead>
        <tr>
            <th>
                床位号
            </th>
            <th>
                所属科室
            </th>
            <th>
                床位状态
            </th>
            <th>
                操作
            </th>
        </tr>
        </thead>
        <tbody class="ss">
        <c:forEach var="bed" items="${bedList}">
            <tr>
                <td>${bed.BNo} </td>
                <td>${bed.bkName}</td>
                <td>
                    <c:if test="${bed.BState eq 1}"><button class="sps">使用中</button></c:if>
                    <c:if test="${bed.BState eq 2}"><button class="sp">空闲中</button></c:if>
                </td>
                <td>
                    <a href="javascript:;" onclick="qryInfo(${bed.BNo});" style="color:#106ea9;text-decoration:underline"><button class="spp">查看</button></a>&nbsp;&nbsp;
                    <a href="javascript:;" onclick="del(${bed.BNo});" style="color:#106ea9;text-decoration:underline"><button class="spp">删除</button></a>
                </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="page" v-show="show">
        <div class="pagelist">

            <input type="hidden" name="totalPageCount" id="totalPageCount" value="${totalPageCount}">
            <span class="jump"><a href="javascript:page_nav(document.forms[0],1);"> 首页</a></span>
            <span class="jump"><a href="javascript:page_nav(document.forms[0],${currentPageNo - 1 });">上一页</a></span>
            <span class="jump"><a href="javascript:page_nav(document.forms[0],${currentPageNo + 1 });">下一页</a></span>
            <span class="jump"><a href="javascript:page_nav(document.forms[0],${totalPageCount });">尾页</a></span>
            <span class="jumppoint">跳转到：</span>
            <span class="jumpinp"><input type="text" name="inputPage" id="inputPage"/></span>
            <button type="button" class="jump gobtn"
                    onClick='jump_to(document.forms[0],document.getElementById("inputPage").value)'>GO
            </button>
            </span>
        </div>
    </div>
</div>
</body>
<script src="../lib/layui/layui.js" charset="utf-8"></script>
<script src="../lib/layui/layui.all.js" charset="utf-8"></script>
<script src="../js/x-layui.js" charset="utf-8"></script>
<script src="../js/jquery2.js" charset="utf-8"></script>
<script src="../js/js.js" charset="utf-8"></script>
<script src="../js/zygl/rollpage.js" charset="utf-8"></script>
<script>
    layui.use(['laydate', 'element', 'laypage', 'layer'], function () {
        $ = layui.jquery;//jquery
        lement = layui.element();//面包导航
        laypage = layui.laypage;//分页
        layer = layui.layer;//弹出层

    });
    function qryInfo(BNo) {
        layer.open({
            type: 2,
            area: ['360px', '300px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade:0.4,
            title: ['床位信息','font-size:20px;text-align:center'],
            content: '${pageContext.request.contextPath}/bedInfo?bNo='+BNo

        })
    }
    //删除床位
    function del(bNo) {
        layer.open({
            // type: 1,
            // area: ['30px', '300px'],
            // fix: false, //不固定
            // maxmin: true,
            // shadeClose: true,
            // shade:0.4,
            btn: ['确定', '取消'],
            title: ['确认删除床位吗','font-size:20px;text-align:center'],
            content: '确认删除床位吗',
            yes:function () {
                $.ajax({
                    type:"get",
                    url:"/delBed?bNo="+bNo,
                    dataType:"json",
                    success:function (data) {
                        var flag = data.retMsg;
                        if (flag){
                            layer.open({
                                title:false,
                                content:'删除成功',
                                end:function () {
                                    // var index = parent.layer.getFrameIndex(window.name);
                                    window.location.reload()
                                }
                            })
                        } else{
                            layer.open({
                                title:false,
                                content:'删除失败'

                            })
                        }
                    }
                })
            }
        })
    }

    function bedAdd() {
        layer.open({
            type: 2,
            area: ['400px', '260px'],
            fix: false, //不固定
            maxmin: true,
            shadeClose: true,
            shade:0.4,
            title: ['床位添加','font-size:20px;text-align:center'],
            content: '${pageContext.request.contextPath}/bedAdd'

        })
    }
</script>
<script>
    $('.tablelist tbody tr:odd').addClass('odd');
</script>

</html>